@extends('layout.master')

@section('content-header')
    <h1>Kipem</h1>
    <ol class="breadcrumb">
        <li><a href="/"><i class="fa fa-dashboard"></i> Dashboard</a></li>
        <li><a href="{{ URL::route('kipems.index') }}"><i class="fa fa-file"></i> Kipem</a></li>
        <li class="active"><i class="fa fa-plus-square"></i> Tambah</li>
    </ol>
@stop

@section('content')
<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-body table-responsive">
				{{ Form::open(array('route'=>array('kipems.create'), 'method'=>'POST', 'class'=>'form-horizontal', 'role'=>'form')) }}
					<div class="callout callout-warning">
	                    <h4>Informasi!</h4>
	                    <p>Input nomor KTP untuk proses penyesuaian data penduduk kipem.</p>
	                </div>
					<div class="form-group">
						{{ Form::label('no_ktp', 'Nomor KTP', array('class' => 'col-sm-2 control-label required')) }}
						<div class="col-sm-10">
							{{Form::text('no_ktp', null, array('class'=>'form-control', 'placeholder'=>'Nomor KTP'))}}
						</div>
					</div>
					
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
							{{ HTML::decode(Form::button('<i class="fa fa-refresh"></i> Reset', array('class'=>'btn btn-success reset','type'=>'reset'))) }}
							{{ HTML::decode(Form::button('<i class="fa fa-angle-right"></i> Lanjutkan', array('class'=>'btn btn-primary lanjut','type'=>'submit', 'disabled'=>'disabled'))) }}
						</div>
					</div>
				{{ Form::close() }}
            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </div>
</div>
@stop

@section('javascript')
<script type="text/javascript">
    function input(){
		if ($('#no_ktp').val() != '') {
			$('.lanjut').removeAttr('disabled');
		}else{
			$('.lanjut').attr('disabled', 'disabled');
		};
	}

	$(document).ready(function() {
		$('#no_ktp').focus();
		input();

		// -------------Validasi input-------------------------
		$('#no_ktp').keyup(function(event) {
			/* Act on the event */
			input();
		});

		$('#no_ktp').change(function(event) {
			/* Act on the event */
			input();
		});
		
		$('.reset').click(function(event) {
			/* Act on the event */
			$('.lanjut').attr('disabled', 'disabled');
			$('#no_ktp').focus();
		});
	});
</script>
@stop